$.ajax({
  url: "/goods/cate",
  method: "get",
  success(res) {
    console.log(res);
    const arr = res.data
      .map((item, i) => {
        return `
            <li><a href="list.html" data-id=${i + 1}>${item.name}</a></li>
            `;
      })
      .join("");
    $(".cate-list").html(arr);
  },
});
$("ul").on("click", "a", function (e) {
  // e.preventDefault();
  console.log($(this).attr("data-id"));
  localStorage.setItem("index", $(this).attr("data-id"));
});
